package com.westvalley.service.api.nc;

import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import com.westvalley.http.HttpXmlClient;

public class NcApproveService extends NcService{
	public static final String KEY = "approveService";
	public static final JsonType jsonType = JsonType.obj;
	//公司编码
	private String unitcode;
	//单据号
	private String billno;
	//审批结果
	private String approvestat;
	
	public static NcApproveService me(String unitcode,String billno,String approvestat){
		return new NcApproveService(unitcode, billno, approvestat);
	}
	
	private NcApproveService(String unitcode,String billno,String approvestat) {
		super(KEY, jsonType);
		this.unitcode = unitcode;
		this.billno = billno;
		this.approvestat = approvestat;
	}
	
	@Override
	protected String executeInterface(Map<String, Object> params) {
		String bodyParam = JSON.toJSONString(params);
		return HttpXmlClient.postBody(this.url, bodyParam, "application/json");
	}

	@Override
	protected Map<String, Object> initParams() {
		Map<String,Object> map = Maps.newHashMap();
		map.put("unitcode", unitcode);
		map.put("billno", billno);
		map.put("approvestat", approvestat);
		return map;
	}

}
